﻿{template 'web/_header'}
{template 'web/allorder/common_search'}
{template 'web/allorder/lottery_tabs'}
<style type='text/css'>
       .trbody td {text-align: center; vertical-align:top;border-left:1px solid #ccc; border-bottom: 1px solid #ddd;}
</style>
{if $operation == 'display'}
<div class="main">
	<div class="panel panel-default">
		<div class="panel-body table-responsive">
			{if $status==6}
                        <form action="{php echo $this->createWebUrl('allorder',array('op'=>'tuikuan','p'=>'lottery_list'));}" method="post" class="form-horizontal">
			{/if}
                        {if $status==8}
			<form action="{php echo $this->createWebUrl('allorder',array('op'=>'choujiang','p'=>'lottery_list'));}" method="post" class="form-horizontal">
			{/if}
			<table class="table table-hover table-bordered">
				<thead class="navbar-inner">
					{if $status==6}
					<div class="col-sm-3 col-lg-1" style="text-align:left;"><button class="btn btn-success" type="submit" onclick="return confirm('此操作不可恢复，确认退款？');">处理退款</button></div>
					{/if}
                                        {if $status==8}
					<div class="col-sm-3 col-lg-1" style="text-align:left;"><button class="btn btn-success" type="submit" onclick="return confirm('此操作不可恢复，确认批量未中奖？');">批量未中奖</button></div>
					{/if}
					<tr>
						{if $status==6}
						<th style="width:60px;" class="text-center"><input type="checkbox" onclick="var ck = this.checked;$(':checkbox').each(function(){this.checked = ck});" />全选</th>
						{/if}
                                                {if $status==8}
						<th style="width:60px;" class="text-center"><input type="checkbox" onclick="var ck = this.checked;$(':checkbox').each(function(){this.checked = ck});" />全选</th>
						{/if}
						<th style="width:180px;" class="text-center">订单号</th>
						<th style="width:200px;" class="text-center">商品信息</th>
						<th style="width:120px;" class="text-center">订单类型</th>
						<th style="width:120px;" class="text-center">买家信息</th>
						<th style="width:80px;" class="text-center">支付方式</th>
						<th style="width:80px;" class="text-center">运费</th>
						<th style="width:80px;" class="text-center">实付<br>应付</th>
						<th style="width:80px;" class="text-center">状态</th>
						<th style="width:160px;" class="text-center">下单时间</th>
						<th style="width:250px;" class="text-center">操作</th>
					</tr>
				</thead>
				<tbody>
					{loop $list $item}
					<tr>
						{if $status==6}
						<td class="text-center"><input type="checkbox" name="checkbox[]"  value="{$item['id']}" /></td>
						{/if}
                                                {if $status==8 && $item['islottery']==0}
						<td class="text-center"><input type="checkbox" name="checkbox[]"  value="{$item['id']}" /></td>
						{/if}
                                                {if $status==8 && $item['islottery']!=0}
                                                <td class="text-center"></td>
                                                {/if}
						<td class="text-center">{$item['orderno']}</td>
						<td><img src="{php echo tomedia($item['gimg'])}" style="width: 40px; height: 40px;padding:1px;"> &nbsp;{$item['gname']}</td>
						<td class="text-center">
							{if $item['is_tuan']==1 || $item['is_tuan']==3}
							<span class="label label-warning">拼团单：{$item['tuan_id']}号</span>
							{elseif $item['is_tuan']==0}
							<span class="label label-success">直购单</span>
							{elseif $item['is_tuan']==2}
					                <span class="label label-default">团满退款单</span>
							{/if}
						</td>
						<td class="text-center">{if $item['cname']}{$item['cname']}{else}{$item['addname']}{/if}<br>{if $item['tel']}{$item['tel']}{else}{$item['mobile']}{/if}</td>
						<td class="text-center">
							<span class="label label-{$item['css']}">{$item['paytype']}</span>
						</td>
						<td class="text-center">{$item['freight']}元</td>
						<td class="text-center">{if empty($item['price'])}0.00{else}{$item['price']}{/if}元<br>{if empty($item['pay_price'])}{$item['price']}{else}{$item['pay_price']}{/if}元</td>
						<td class="text-center">
						<span class="label label-{$item['statuscss']}">{$item['status']}</span>
						<td class="text-center">{php echo date('Y-m-d H:i:s', $item['createtime'])}</td>
						<td class="text-center">
							<div class="btn-group">
                                                               {if $status==8 && $item['islottery']==0}
                                                               <a href="{php echo $this->createWebUrl('allorder', array('id' => $item['id'], 'op' => 'draw','islottery'=>'2','p'=>'lottery_list'))}" onclick="return confirm('此操作不可恢复，确认未中奖？');"
									class="btn btn-default btn-sm" data-toggle="tooltip" data-placement="bottom" title="未中奖">未中奖
								</a>
                                                                <a href="{php echo $this->createWebUrl('allorder', array('id' => $item['id'], 'op' => 'draw','islottery'=>'1','p'=>'lottery_list'))}" onclick="return confirm('此操作不可恢复，确认中奖？');"
									class="btn btn-danger btn-sm" data-toggle="tooltip" data-placement="bottom" title="中奖">中奖
								</a>
                                                               {/if}
                                                               <a href="{php echo $this->createWebUrl('allorder', array('op' => 'detail', 'id' => $item['id'],'is_tuan'=>1,'p'=>'lottery_list'))}" class="btn btn-success btn-sm">查看订单</a>
								<a href="{php echo $this->createWebUrl('allorder', array('id' => $item['id'], 'op' => 'delete','p'=>'lottery_list'))}" onclick="return confirm('此操作不可恢复，确认删除？');"
									class="btn btn-default btn-sm" data-toggle="tooltip" data-placement="bottom" title="删除">删除
								</a>
							</div>
						</td>
					</tr>
					{/loop}
				</tbody>
			</table>
		</div>
		{if $status==6}
		</form>
		{/if}
	</div>
</div>
{$pager}
<script type="text/javascript">
	require(['daterangepicker'], function($){
		$('.daterange').on('apply.daterangepicker', function(ev, picker) {
			$('#form1')[0].submit();
		});
	});
</script>
{/if}
<script>
	require(['bootstrap'],function($){
		$('.btn').hover(function(){
			$(this).tooltip('show');
		},function(){
			$(this).tooltip('hide');
		});
	});
</script>
{template 'web/_footer'}